import java.util.ArrayList;
import java.util.Arrays;

public class MathUtils {

    public static final int FIRST_PRIME_NUMBER = 2;

    public static Integer[] doFactorization(int inputNumber) {
        ArrayList<Integer> result = new ArrayList<Integer>();
        if(inputNumber == FIRST_PRIME_NUMBER){
            result.add(inputNumber);
        } else if(inputNumber > FIRST_PRIME_NUMBER){
            for (int divider = FIRST_PRIME_NUMBER; divider < inputNumber; divider++) {
                if( inputNumber % divider == 0){
                    result.add(divider);
                    result.addAll(Arrays.asList(doFactorization(inputNumber / divider)));
                    break;
                }
            }
        }
        if( inputNumber > FIRST_PRIME_NUMBER && result.isEmpty()){
            result.add(inputNumber);
        }
        return result.toArray(new Integer[]{});
    }
}
